﻿using System;
using System.Collections.Generic;
using System.Reflection;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Text.RegularExpressions;

namespace ZD_Utility
{
    public class ZD_WebConfig
    {
        #region 检查是否启用伪删除
        /// <summary>
        /// 检查是否启用伪删除
        /// </summary>
        /// <param name="Column">Where条件</param>
        /// <returns>True为启用，Fasle为关闭</returns>
        public static string GetInfoAboutDelete(object Where, ref bool IsDelete, ref string DeleteColumn)
        {
            //读取Webconfig伪删除配置信息
            string AboutDelete = System.Configuration.ConfigurationManager.AppSettings["Delete"];
            string WhereCondition = string.Empty;
            if (!string.IsNullOrEmpty(AboutDelete))
            {
                string[] Arr = AboutDelete.Split(',');
                if (Arr.Length > 1)
                {
                    IsDelete = bool.Parse(Arr[0].ToLower());
                    DeleteColumn = Arr[1];
                    if (!Where.IsNull() && !Where.ToString().IsNullOrEmpty())
                    {
                        WhereCondition = Where.ToString() + " and " + Arr[1] + "<99 ";
                    }
                    else
                    {
                        WhereCondition = Arr[1] + "<99 ";
                    }
                }
            }
            return WhereCondition;
        }
        #endregion
    }
}
